2000W / 48V LLC Battery-Charger  V1.00

General Purpose Input Output (GPIO) driver for the XMC microcontroller family. More...

Collaboration diagram for GPIO:

Macros

#define PORT_IOCR_PC_Pos   PORT0_IOCR0_PC0_Pos
 
#define PORT_IOCR_PC_Msk   PORT0_IOCR0_PC0_Msk
 
#define PORT_IOCR_PC_Size   (8U)
 
#define XMC_GPIO_CHECK_OUTPUT_LEVEL(level)
 
#define XMC_GPIO_CHECK_HWCTRL(hwctrl)
 

Typedefs

typedef enum XMC_GPIO_OUTPUT_LEVEL XMC_GPIO_OUTPUT_LEVEL_t
 
typedef enum XMC_GPIO_HWCTRL XMC_GPIO_HWCTRL_t
 

Enumerations

enum  XMC_GPIO_OUTPUT_LEVEL { XMC_GPIO_OUTPUT_LEVEL_LOW = 0x10000U, XMC_GPIO_OUTPUT_LEVEL_HIGH = 0x1U }
 
enum  XMC_GPIO_HWCTRL { XMC_GPIO_HWCTRL_DISABLED = 0x0U, XMC_GPIO_HWCTRL_PERIPHERAL1 = 0x1U, XMC_GPIO_HWCTRL_PERIPHERAL2 = 0x2U }
 

Functions

void XMC_GPIO_Init (XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config)
 
void XMC_GPIO_SetMode (XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode)
 
__STATIC_INLINE void XMC_GPIO_SetOutputLevel (XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_OUTPUT_LEVEL_t level)
 
__STATIC_INLINE void XMC_GPIO_SetOutputHigh (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE void XMC_GPIO_SetOutputLow (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE void XMC_GPIO_ToggleOutput (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE uint32_t XMC_GPIO_GetInput (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE void XMC_GPIO_EnablePowerSaveMode (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE void XMC_GPIO_DisablePowerSaveMode (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
void XMC_GPIO_SetHardwareControl (XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_HWCTRL_t hwctrl)
 
__STATIC_INLINE void XMC_GPIO_EnableDigitalInput (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 
__STATIC_INLINE void XMC_GPIO_DisableDigitalInput (XMC_GPIO_PORT_t *const port, const uint8_t pin)
 

Detailed Description

General Purpose Input Output (GPIO) driver for the XMC microcontroller family.

GPIO driver provide a generic and very flexible software interface for all standard digital I/O port pins. Each port slice has individual interfaces for the operation as General Purpose I/O and it further provides the connectivity to the on-chip periphery and the control for the pad characteristics.

The driver is divided into Input and Output mode.

Input mode features:

  1. Configuration structure XMC_GPIO_CONFIG_t and initialization function XMC_GPIO_Init()
  2. Allows the selection of weak pull-up or pull-down device. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode()

Output mode features:

  1. Allows the selection of push pull/open drain and Alternate output. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode()
  2. Allows the selection of initial output level. Configuration structure XMC_GPIO_OUTPUT_LEVEL_t and function XMC_GPIO_SetOutputLevel()

Macro Definition Documentation

◆ PORT_IOCR_PC_Msk

#define PORT_IOCR_PC_Msk   PORT0_IOCR0_PC0_Msk

Definition at line 98 of file xmc_gpio.h.

Referenced by XMC_GPIO_Init(), and XMC_GPIO_SetMode().

◆ PORT_IOCR_PC_Pos

#define PORT_IOCR_PC_Pos   PORT0_IOCR0_PC0_Pos

Definition at line 97 of file xmc_gpio.h.

◆ PORT_IOCR_PC_Size

#define PORT_IOCR_PC_Size   (8U)

Definition at line 100 of file xmc_gpio.h.

Referenced by XMC_GPIO_Init(), and XMC_GPIO_SetMode().

◆ XMC_GPIO_CHECK_HWCTRL

#define XMC_GPIO_CHECK_HWCTRL (   hwctrl)

◆ XMC_GPIO_CHECK_OUTPUT_LEVEL

#define XMC_GPIO_CHECK_OUTPUT_LEVEL (   level)

Typedef Documentation

◆ XMC_GPIO_HWCTRL_t

Defines direct hardware control characteristics of the pin . Use type XMC_GPIO_HWCTRL_t for this enum.

◆ XMC_GPIO_OUTPUT_LEVEL_t

Defines output level of a pin. Use type XMC_GPIO_OUTPUT_LEVEL_t for this enum.

Enumeration Type Documentation

◆ XMC_GPIO_HWCTRL

Defines direct hardware control characteristics of the pin . Use type XMC_GPIO_HWCTRL_t for this enum.

Enumerator
XMC_GPIO_HWCTRL_DISABLED 

Software control only

XMC_GPIO_HWCTRL_PERIPHERAL1 

HWI0/HWO0 control path can override the software configuration

XMC_GPIO_HWCTRL_PERIPHERAL2 

HWI1/HWO1 control path can override the software configuration

Definition at line 127 of file xmc_gpio.h.

◆ XMC_GPIO_OUTPUT_LEVEL

Defines output level of a pin. Use type XMC_GPIO_OUTPUT_LEVEL_t for this enum.

Enumerator
XMC_GPIO_OUTPUT_LEVEL_LOW 

Reset bit

XMC_GPIO_OUTPUT_LEVEL_HIGH 

Set bit

Definition at line 118 of file xmc_gpio.h.

Function Documentation

◆ XMC_GPIO_DisableDigitalInput()

__STATIC_INLINE void XMC_GPIO_DisableDigitalInput ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_PDISC.
pinport pin number.
Returns
None
Related APIs:
None
Description:
Disable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only for analog port pins.

Definition at line 458 of file xmc_gpio.h.

◆ XMC_GPIO_DisablePowerSaveMode()

__STATIC_INLINE void XMC_GPIO_DisablePowerSaveMode ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_PPS.
pinport pin number.
Returns
None
Description:
Disables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters Deep Sleep mode. This configuration enables input Schmitt-Trigger and output driver stage(if pin is enabled power save mode previously). By default port pin does not react to power save mode request.
Related APIs:
XMC_GPIO_EnablePowerSaveMode()
Note:
Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so may result in an undefined behavior of the pin when the device enters the Deep Sleep state.

Definition at line 390 of file xmc_gpio.h.

◆ XMC_GPIO_EnableDigitalInput()

__STATIC_INLINE void XMC_GPIO_EnableDigitalInput ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_PDISC.
pinport pin number.
Returns
None
Related APIs:
None
Description:
Enable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only for analog port pins.

Definition at line 435 of file xmc_gpio.h.

◆ XMC_GPIO_EnablePowerSaveMode()

__STATIC_INLINE void XMC_GPIO_EnablePowerSaveMode ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_PPS.
pinport pin number.
Returns
None
Description:
Enables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters Deep Sleep mode.Port pin enabled with power save mode option are set to a defined state and the input Schmitt-Trigger as well as the output driver stage are switched off. By default port pin does not react to power save mode request.
Related APIs:
XMC_GPIO_DisablePowerSaveMode()

Note:
Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so may result in an undefined behavior of the pin when the device enters the Deep Sleep state.

Definition at line 361 of file xmc_gpio.h.

◆ XMC_GPIO_GetInput()

__STATIC_INLINE uint32_t XMC_GPIO_GetInput ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_IN.
pinPort pin number.
Returns
uint32_t pin logic level status.
Description:
Reads the Pn_IN register and returns the current logical value at the GPIO pin.
Related APIs:
None
Note:
Prior to this api, user has to configure port pin to input mode using XMC_GPIO_SetMode().

Definition at line 333 of file xmc_gpio.h.

Referenced by L0_Read_LowLine(), L0_Read_Umschalter(), and L0_Read_Wahl_Schalter().

Here is the caller graph for this function:

◆ XMC_GPIO_Init()

void XMC_GPIO_Init ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin,
const XMC_GPIO_CONFIG_t *const  config 
)
Parameters
portConstant pointer pointing to GPIO port, to access port registers like Pn_OUT,Pn_OMR,Pn_IOCR etc.
pinPort pin number.
configGPIO configuration data structure. Refer data structure XMC_GPIO_CONFIG_t for details.
Returns
None
Description:
Related APIs:
None
Note:
This API is called in definition of DAVE_init by code generation and therefore should not be explicitly called for the normal operation. Use other APIs only after DAVE_init is called successfully (returns DAVE_STATUS_SUCCESS).

Definition at line 69 of file xmc1_gpio.c.

Referenced by L0_GPIO_Config().

Here is the caller graph for this function:

◆ XMC_GPIO_SetHardwareControl()

void XMC_GPIO_SetHardwareControl ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin,
const XMC_GPIO_HWCTRL_t  hwctrl 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_HWSEL.
pinport pin number.
hwctrldirect hardware control selection. Refer XMC_GPIO_HWCTRL_t for valid values.
Returns
None
Description:
Selects direct hard ware control and configures Pn_HWSEL register.This configuration is useful for the port pins overlaid with peripheral functions for which the connected peripheral needs hardware control.
Related APIs:
None
Note:
Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so may result in an undefined behavior of the pin when the device enters the Deep Sleep state.

Definition at line 74 of file xmc_gpio.c.

◆ XMC_GPIO_SetMode()

void XMC_GPIO_SetMode ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin,
const XMC_GPIO_MODE_t  mode 
)
Parameters
portConstant pointer pointing to GPIO port, to access hardware register Pn_IOCR.
pinPort pin number.
modeinput / output functionality selection. Refer XMC_GPIO_MODE_t for valid values.
Returns
None
Description:
Sets digital input and output driver functionality and characteristics of a GPIO port pin. It configures hardware registers Pn_IOCR. mode is initially configured during initialization in XMC_GPIO_Init(). Call this API to alter the port direction functionality as needed later in the program.
Related APIs:
None

Definition at line 65 of file xmc_gpio.c.

◆ XMC_GPIO_SetOutputHigh()

__STATIC_INLINE void XMC_GPIO_SetOutputHigh ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_OMR.
pinPort pin number.
Returns
None
Description:
Sets port pin output to high. It configures hardware registers Pn_OMR.
Related APIs:
XMC_GPIO_SetOutputLow()
Note:
Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode().
Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0.

Definition at line 256 of file xmc_gpio.h.

Referenced by IRQ21_Handler(), L0_Eeprom_Disable_ChipSelect(), L0_Switch_Bms(), L0_Switch_LED_Anzeige(), L0_Switch_LED_Wahl_Schalter(), L0_Switch_Power(), and L0_Switch_Verpolschutz().

Here is the caller graph for this function:

◆ XMC_GPIO_SetOutputLevel()

__STATIC_INLINE void XMC_GPIO_SetOutputLevel ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin,
const XMC_GPIO_OUTPUT_LEVEL_t  level 
)
Parameters
portConstant pointer pointing to GPIO port, to access hardware register Pn_OMR.
pinPort pin number.
leveloutput level selection. Refer XMC_GPIO_OUTPUT_LEVEL_t for valid values.
Returns
None
Description:
Set port pin output level to high or low.It configures hardware registers Pn_OMR.level is initially configured during initialization in XMC_GPIO_Init(). Call this API to alter output level as needed later in the program.
Related APIs:
XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow().
Note:
Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode().

Definition at line 229 of file xmc_gpio.h.

◆ XMC_GPIO_SetOutputLow()

__STATIC_INLINE void XMC_GPIO_SetOutputLow ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_OMR.
pinport pin number.
Returns
None
Description:
Sets port pin output to low. It configures hardware registers Pn_OMR.
Related APIs:>
XMC_GPIO_SetOutputHigh()
Note:
Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0.

Definition at line 282 of file xmc_gpio.h.

Referenced by IRQ21_Handler(), L0_Eeprom_Enable_ChipSelect(), L0_Switch_Bms(), L0_Switch_LED_Anzeige(), L0_Switch_LED_Wahl_Schalter(), L0_Switch_Power(), and L0_Switch_Verpolschutz().

Here is the caller graph for this function:

◆ XMC_GPIO_ToggleOutput()

__STATIC_INLINE void XMC_GPIO_ToggleOutput ( XMC_GPIO_PORT_t *const  port,
const uint8_t  pin 
)
Parameters
portconstant pointer pointing to GPIO port, to access hardware register Pn_OMR.
pinport pin number.
Returns
None
Description:
Configures port pin output to Toggle. It configures hardware registers Pn_OMR.
Related APIs:
XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow().
Note:
Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0.

Definition at line 308 of file xmc_gpio.h.